<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<base href="<%=basePath%>">
<html>
<head>

    <title>库房分配</title>
    <style type="text/css">
        td {
            font-size: 14px;
            text-align: center;
        }

        input {
            text-align: center;
        }

        table {
            text-align: center;
        }

        #sousuo1 {
            background-image: img / search-icon . png;
            position: relative;
            top: -18px;
            left: -15px
        }

        #xinxi {
            display: none;
            background-color: powderblue;
            position: absolute;
            left: 700PX;
            top: 180px;
        }

    </style>
    <link type="text/css" rel="stylesheet" href="css/style.css"/>
    <link type="text/css" rel="stylesheet" href="css/index.css"/>
    <script src="js/jquery.min.js"></script>
    <!-- 动态菜单JS -->
    <script type="text/javascript" src="js/menu.js"></script>
</head>

<body>

<div class="container">
    <div class="cont-top">
        <div class="companyname">ERP管理系统</div>
        <div class="cont-top-middle">
            <ul>
                <li><h1 STYLE="font-size: 45px;margin-left: 430px; margin-top: 10px">第&nbsp;五&nbsp;人&nbsp;民&nbsp;医&nbsp;院</h1>
                </li>

            </ul>
        </div>
        <div class="cont-top-rg">
            <ul class="advanced-menu">
                <li>
                    <div class="top-search">
                        <div class="t-s-l">
                            <span class="left-line"></span> <input type="text" value="搜库存"
                                                                   class="search-type" disabled> <span
                                class="triangle-bottom"></span>
                        </div>
                        <div class="t-s-l">


                            <form action="BuyServlet?act=sousuo" method="post">
                                <input type="text" placeholder="请输入商品编码或名称" name="sou"
                                       class="search-dt"> <span class="right-line"></span>
                                <span class="right-line"> <input
                                        type="submit" value="搜索" id="sousuo1"/></span>
                            </form>


                        </div>
                    </div>
                </li>
                <li class="default" style="position: relative;"><span
                        class="user"><img src="img/user.png"></span> <a
                        class="special" onclick="denglu()">${user.userName} <i><img
                        src="img/xl.png"></i></a>
                    <div class="drop-down-wrap"
                         style="width: 180px; left: 15px; display: none;">
                        <div class="drop-down">
                            <span class="triangle-border"></span> <span class="triangle-bg"></span>
                            <ul class="del-ul">
                                <li><a href="#" class="hot">首耀照明</a></li>
                                <li><a href="#">小丫头</a></li>
                                <li><a href="#">操作日志</a></li>
                            </ul>
                        </div>
                    </div>
                </li>
            </ul>
            <ul class="advanced-menu">
                <li id="p" style="display: none;"></li>
                <li><a href="#"><img src="img/top-icon2.png"></a></li>
                <li><a href="#"><img src="img/top-icon3.png"></a></li>
                <li><a href="#"><img src="img/top-icon4.png"></a></li>
                <li><a href="#"><img src="img/top-icon5.png"></a></li>
            </ul>
        </div>
    </div>
    <div class="left-menu" style="height:949px;">
        <div class="menu-list">
            <ul>
                <%--                menuNameOne menuPathList--%>
                <c:forEach var="menuNameOne" items="${menuNameOne}">
                    <li class="menu-list-01">

                        <p class="fumenu">${menuNameOne.menuNameOne}</p>
                        <img class="xiala" src="img/xiala.png"/>

                        <div class="list-p">
                            <c:forEach var="menuPathList" items="${menuPathList}">
                                <c:if test="${menuNameOne.menuNameOne==menuPathList.menuNameOne}">

                                    <a href="${menuPathList.menu.menuPath}" id="href">
                                        <p class="zcd" id="zcd5">${menuPathList.menu.menuNametwo}</p>
                                    </a>
                                </c:if>
                            </c:forEach>
                        </div>
                    </li>
                </c:forEach>
            </ul>


        </div>
    </div>


    <div class="right-menu">
        <div class="main-hd">
            <div class="page-teb">
                <div class="l-tab-links">
                    <ul style="left: 0;">
                        <li class="l-select"><a href="index.jsp"
                                                style="padding: 0px 25px;">首页</a></li>
                        <li class="l-select"><a href="#">库房分配</a> <span
                                class="close"></span></li>
                    </ul>
                </div>

                <div class="l-tab-content" style="background: #fff;">
                    <div class="tab-content-item">
                        <div class="home">
                            <!--库房分配   开始-->
                            <div class="kufang-box" style="height: 120px;margin-top: -10px;">
                                <div class="kufang" style="height: 80px;margin-left: -150px;margin-top: 5px">

                                    <div>
                                        <div class="kf-fl">
                                            <ul>
                                                <li STYLE="font-size: 15px;margin-left: 530px;margin-top: -12px; ">
                                                    日期:<SPAN></SPAN></li>

                                            </ul>

                                        </div>
                                        <div class="kf-fl">
                                            <ul>
                                                <li STYLE="font-size: 15px;margin-left: 530px;margin-top: -12px; ">
                                                    <SPAN></SPAN></li>

                                            </ul>

                                        </div>
                                    </div>
                                </div>

                                <div class="kf-tab"
                                     style="margin-left: 300px;width: 1000px;margin-top: -50px;height: 700PX">


                                    <div class="kfbody" tabindex="0" STYLE="height: 700PX">
                                        <table border="0" cellpadding="0" cellspacing="1"
                                               class="fkbody-rows" style="width: 100%;">
                                            <tbody>





                                            <td class="caption cao-l">

                                                <div class="caotion-kf-txt"
                                                     style="overflow: hidden; text-align: center;">一级菜单
                                                </div>
                                            </td>
                                            <td class="caption cao-l">
                                                <div class="caotion-kf-txt"
                                                     style="overflow: hidden; text-align: center;">二级菜单
                                                </div>
                                            </td>



                                            </tr>
                                            </tbody>

                                            <tbody>


                                            <form action="UserPermissions/messagesubmit" id="menu" method="post"
                                                  id="container">
                                                <tr class="fkbody-s" _rowindex="0">

                                                <c:forEach var="menuPath" items="${menuPathList}" varStatus="menu" >

                                                        <c:if test="${menuPath.menu.menuNameOne!=zhi}">



                                                    <td class="bodyrow-list" _columnindex="0" style="background-color:#f7e1b5">
                                                        <c:set var="a" value="1"></c:set>
                                                        <div class="bodytxt"
                                                             style="overflow: hidden; text-align: center; ">

                                                            <input type="checkbox" name="${menuPath.menu.menuNameOne}"
                                                                   onclick="upda(this.name)" id="" value=""/>
                                                            全选/取消


                                                        </div>
                                                    </td>

                                                    <td class="bodyrow-list" _columnindex="0"  style="background-color:#f7e1b5">
                                                        <div class="bodytxt"
                                                             style="overflow: hidden; text-align: center; ">


                                                            <input type="checkbox" name="menuNametwo1" id=""
                                                                   value=""/> 全选/取消


                                                        </div>

                                                    </td>


                                                </tr>

                                                    </c:if>





                                                <tr class="fkbody-s" _rowindex="0">

                                                    <td class="bodyrow-list" _columnindex="0">
                                                        <div class="bodytxt"
                                                             style="overflow: hidden; text-align: center; ">

                                                            <input type="checkbox" name="${menuPath.menu.menuNameOne}1" id=""
                                                                   onclick="twoChange(this.name)"
                                                                   value="${menuPath.menu.menuNameOne}"/>
                                                                ${menuPath.menu.menuNameOne}


                                                        </div>
                                                    </td>

                                                    <td class="bodyrow-list" _columnindex="0">
                                                        <div class="bodytxt"
                                                             style="overflow: hidden; text-align: center; ">


                                                            <input type="checkbox" name="${menuPath.menu.menuNameOne}2" id=""
                                                                   value="${menuPath.menu.menuNametwo}"/>${menuPath.menu.menuNametwo}


                                                        </div>

                                                    </td>


                                                </tr>


                                                    <c:set var="a" value="${a+1}"></c:set>

                                            </tbody>
                                            <c:set var="zhi" value="${menuPath.menu.menuNameOne}"></c:set>
                                            </c:forEach>
                                            </form>
                                        </table>


                                    </div>


                                    <div class="lu">
                                        共<i>${a-1}</i>条记录
                                    </div>

                                </div>
                                <div class="tab-btn">
                                    <div class="bt-f">
                                        <ul>
                                            <li>
                                                <button style="margin-left: 300px"
                                                        class="button-li" onclick="submito()">提交
                                                </button>
                                            </li>

                                        </ul>
                                    </div>
                                    <div class="bt-rg">
                                        <ul>
                                            <li>
                                                <button>打印</button>
                                            </li>
                                            <li>
                                                <button>退出</button>
                                            </li>
                                        </ul>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>


</body>
<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script>

    function upda(val) {

        $("input[name=" + val + "]").each(function () {

            if ($(this).prop("checked") == true) {

                $("input[name="+val+"1]").each(function () {
                    $(this).prop("checked", 'true');
                    $(this).parent().parent().next().children().children().prop("checked", 'true');
                })

            } else if ($("input[name=" + val + "]").prop("checked") == false) {
                $("input[name="+val+"1]").each(function () {
                    $(this).removeAttr("checked");
                    $(this).parent().parent().next().children().children().removeAttr("checked");
                })
            }


        })

    }


    function twoChange(val) {
       $("input[name=" + val + "]").each(function () {

           if ($(this).prop("checked")==true){
               $(this).parent().parent().next().children().children().prop("checked", 'true');
           }else{
               $(this).parent().parent().next().children().children().removeAttr("checked");
           }


       })






    }


    <c:forEach var="userPermissionsList" items="${userPermissionsList}">


    $("input").each(function () {

        if ($(this).val() == '${userPermissionsList.menu.menuNameOne}') {

            $(this).attr("checked", "checked")

        }

    })


    </c:forEach>

    <c:forEach var="userPermissionsList" items="${userPermissionsList}">


    $("input").each(function () {

        if ($(this).val() == '${userPermissionsList.menu.menuNametwo}') {

            $(this).attr("checked", "checked")

        }

    })


    </c:forEach>


    function del(val) {

        $("#" + val).parent().parent().parent().remove();


    }

    function add(val) {

        var a = $("#" + val).parent().parent().parent().html()
        // $("#"+val).parent().parent().parent().remove();
        var b = $("#" + val).parent().parent().parent().parent().append(a)
        var num = $("#" + val).parent().parent().parent().parent().children("tr").length
        alert(num)
        $(b).children().eq(num + 1).children().eq(0).html('${a}')
    }

    function submito() {

        $("input[type='checkbox']").attr("name","lll");
        $("input[type='checkbox']").each(function () {

            if($(this).val()==null||$(this).val()==""){

                $(this).attr("name","1");
            }

        })


        var bl = confirm("确认提交")
        if (bl == true) {
            $("#menu").submit()

        }


    }


    function change1(val) {

        <c:forEach items="${menuChildcopy}" var="son">
        if ("${son.menuNametwo}" == val) {


            $("select").each(function () {

                if ($(this).val() == val) {
                    $(this).parent().parent().next().find("input").val("${son.menuPath}")


                }

            })

        }
        </c:forEach>

    }


</script>

</html>
